package com.polaris.live.im.sfs.core.bean.impl

import com.polaris.live.im.sfs.core.bean.MessageRequest
import com.polaris.live.im.utils.SmartFoxUtils
import com.smartfoxserver.v2.entities.data.ISFSObject
import sfs2x.client.entities.Room

/**
 * 消息请求
 *
 * @author Created by lucas on 2023/10/18 20:57
 * @since 1.0.0
 */
abstract class AbstractChatMessageRequest(
    /**
     * 消息id
     */
    msgId: String,
    /**
     * 消息命令
     */
    command: String,
    /**
     * 消息参数
     */
    params: ISFSObject,
    /**
     * 房间，不是房间消息不用传
     */
    room: Room? = null
) : MessageRequest(msgId, command, params, room) {

    constructor(msgId: String, command: String, params: Any, room: Room? = null)
            : this(msgId, command, SmartFoxUtils.toSFSObject(params), room)
}

class DefaultChatMessageRequest(
    /**
     * 消息id
     */
    msgId: String,
    /**
     * 消息命令
     */
    command: String,
    /**
     * 消息参数
     */
    params: ISFSObject,
    /**
     * 房间，不是房间消息不用传
     */
    room: Room? = null
) : AbstractChatMessageRequest(msgId, command, params, room) {

    constructor(msgId: String, command: String, params: Any, room: Room? = null)
            : this(msgId, command, SmartFoxUtils.toSFSObject(params), room)
}